package com.android.fragmentdemo.adapters
import android.util.Log
import com.android.fragmentdemo.R
import com.android.fragmentdemo.databinding.RvFloatItemLayoutBinding
import com.hengfoxwolf.commonbase.base.adapter.BaseRvAdapter

class FloatRvAdapter() : BaseRvAdapter<String, RvFloatItemLayoutBinding>() {

    override fun getLayoutId(): Int = R.layout.rv_float_item_layout

    override fun bindData(holder: ViewHolder, dataItem: String, position: Int) {
        holder.binding.floatTvContent.text = dataItem
    }

    override fun listenerWithBinding(binding: RvFloatItemLayoutBinding) {
        super.listenerWithBinding(binding)
        Log.d(TAG, "id:${binding.root.id}")
        binding.floatTvContent.setOnClickListener {
            mOnItemClickListener?.onItemClick(
                binding.root.tag as String,
                binding.root.id,
                binding.floatTvContent.id
            )
        }
    }

    companion object {
        const val TAG = "FloatRvAdapter"
    }
}